package com.itheima.day05;

public class getMaxAndMin {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 66, 55, 44,};
        int[] maxAndMin = getMaxAndMin(arr);
        System.out.println("max:"+maxAndMin[0]);
        System.out.println("min:"+maxAndMin[1]);
    }

    public static int[] getMaxAndMin(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }

        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int[] maxAndMin = {max, min};
        return maxAndMin;
    }
}
